<?php
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class SystemSetting extends Model
{
    protected $table='system_setting';
    
    protected $primaryKey = 'id';
    
    protected $fillable = ['id','varname','value','app'];
    
    public $timestamps = false;
    
    
    public function getSetting($app='index')
    {
        $settings =array();
        $system_setting = DB::table($this->table)->where('app','=',$app)->get();
        foreach ($system_setting as $val)
        {
            $settings[$val->varname] = unserialize($val->value);
        }
        return $settings;
    }
    
}